Skip to content

Conversation

@codingpeanut157
Copy link
Contributor

@codingpeanut157 codingpeanut157 commented Nov 25, 2025

add missing deadline

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 25, 2025

Deploying wildcat-dashboard with  Cloudflare Pages  Cloudflare Pages

Latest commit: fbc5bfa
Status: ✅  Deploy successful!
Preview URL: https://4a34f516.wildcat-dashboard.pages.dev
Branch Preview URL: https://peanut-requesttopay-1.wildcat-dashboard.pages.dev

View logs

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pages/quotes/QuotePage.tsx 0.00% 18 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot finished reviewing on behalf of codingpeanut157 November 25, 2025 11:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a missing deadline field to the request-to-pay functionality by integrating a Calendar component that allows users to select a payment deadline before submitting a payment request.

Key changes:

  • Added a deadline field to the RequestToMintRequest type definition
  • Integrated a Calendar component in the "Request to Pay" confirmation drawer to capture the deadline
  • Modified the requestToPayMutation to accept and send the deadline parameter with the API request

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/pages/quotes/QuotePage.tsx Added state management for deadline date, integrated Calendar component in the ConfirmDrawer, and updated mutation function to accept and pass the deadline to the API
src/generated/client/types.gen.ts Added deadline: string field to the RequestToMintRequest type definition
Comments suppressed due to low confidence (1)

src/pages/quotes/QuotePage.tsx:329

  • The mutation function signature should accept Date | undefined to match the type of requestToPayDate state. Additionally, it should validate that the deadline is defined before using it:
mutationFn: async (deadline: Date | undefined) => {
  if (!deadline) {
    throw new Error("Deadline is required")
  }
  const { data } = await requestToMint({
    body: {
      ebill_id: value.bill.id,
      amount: value.bill.sum,
      deadline: deadline.toISOString()
    },
    throwOnError: true,
  })
  return data
},
    mutationFn: async (deadline: Date) => {
      const { data } = await requestToMint({
        body: {
          ebill_id: value.bill.id,
          amount: value.bill.sum,
          deadline: String(deadline)
        },
        throwOnError: true,
      })
      return data
    },

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codingpeanut157 codingpeanut157 marked this pull request as ready for review November 25, 2025 11:53
Copy link

@zupzup zupzup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

const [enableMintingConfirmDrawerOpen, setEnableMintingConfirmDrawerOpen] = useState(false)
const [requestToPayConfirmDrawerOpen, setRequestToPayConfirmDrawerOpen] = useState(false)
const [payRequestResponse, setPayRequestResponse] = useState<RequestToMintResponseInfo | null>(null)
const [requestToPayDate, setRequestToPayDate] = useState<Date | undefined>(addDays(new Date(Date.now()), 2));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI - the request to pay date has to be at least UTC end_of_day(now() + 48h)

So e.g. if you would do it now (13:05, Tuesday), the minimum TS wouldn't be 13:05 Thursday, but 23:59:59.999_999 Thursday.

So if you want a safe default, 3 days would be better, otherwise you can always calculate the end of day of the selected date.

add missing deadline
@codingpeanut157 codingpeanut157 merged commit 922b6f5 into dev Nov 25, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants